package com.kunya.product.controller.portall;


import com.kunya.common.common.ServerResponse;
import com.kunya.product.po.Slider;
import com.kunya.product.service.ISliderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping(value = "/slider")
public class SliderController {

    @Autowired
    private ISliderService iSliderService;

    /**
     * 显示logo图片
     * @param slider
     * @return
     */
    @RequestMapping(value = "/select")
    public ServerResponse select(Slider slider){
        return iSliderService.select(slider);
    }

    /**
     *设置logo图片显示隐藏
     * @param slider
     * @return
     */
    @RequestMapping(value = "/updateStatus")
    public ServerResponse updateStatus(Slider slider){
        return iSliderService.updateStatus(slider);
    }

    /**
     * 删除图片
     * @param slider
     * @return
     */
    @RequestMapping(value = "/delete")
    public ServerResponse delete(Slider slider){
        return iSliderService.delete(slider);
    }

    /**
     * 上传logo图片（如果有的话更新）
     * @param
     * @return
     */
    @RequestMapping(value = "/uploadView")
    public ServerResponse uploadView(MultipartFile file,Integer id) throws IOException {
        return iSliderService.uploadView(file,id);
    }


}
